目录
引言
数学:验证矩阵对角线元素和等于特征值之和
应用而言:给定图像,计算他的Hessian矩阵,Laplace算子 = Hessian矩阵的特征值之和。
即:Laplace= EigenOfHessian
一、矩阵一阶偏导数
1. X轴方向
编写代码:
def gradx(Img, sx = 1.0):
return sx * (Img[1: , : ] - Img[ :-1, : ])
2. Y轴方向
编写代码:
def grady(Img, sy = 1.0):
return sy * (Img[ : , 1: ] - Img[ : , : -1])
二、矩阵二阶偏导数
1. X轴方向上二阶偏导
编写代码:
def gradxx(img, sx = 1.0):
return sx ** 2 * (img[2 : ] + img[ : -2] - 2 * img[1 : -1])